/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.entidade.humana;

import br.com.deployment.entidade.localidade.Endereco;
import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author elyjr
 */
@Entity
public class Titular implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name = "seq_titular", sequenceName = "seq_titular",allocationSize = 1)
    @GeneratedValue(generator = "seq_titular", strategy = GenerationType.SEQUENCE)
    private int id;

    @Column
    private String nome;
    
    @Column(length=20)
    private String rg;
    
    @Column(length=11)
    private String cpf;
    
    @OneToOne(cascade= CascadeType.ALL,fetch= FetchType.EAGER)
    private Endereco endereco;
    
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public Endereco getEndereco() {
        return endereco;
    }

    public void setEndereco(Endereco endereco) {
        this.endereco = endereco;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getRg() {
        return rg;
    }

    public void setRg(String rg) {
        this.rg = rg;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Titular other = (Titular) obj;
        if (this.id != other.id) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 79 * hash + this.id;
        return hash;
    }

    @Override
    public String toString() {
        return "Titular{" + "id=" + id + ", nome=" + nome + ", rg=" + rg + ", cpf=" + cpf + ", endereco=" + endereco + '}';
    }

    
    
    
}
